package com.powernode.money.vo;

import java.io.Serializable;

public class ApiResult implements Serializable {

    public ApiResult() {
    }

    public ApiResult(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    private int code;
    private String msg;
    private Object data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    //成功
    public static ApiResult success(){
        return new ApiResult(200, "操作成功", null);
    }
    //成功并返回数据
    public static ApiResult success(Object data){
        return new ApiResult(200, "操作成功", data);
    }

    //失败并返回消息
    public static ApiResult error(String msg){
        return new ApiResult(500, msg,null);
    }
}

